Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Maven cache to CircleCI config #503

Merged
merged 1 commit into from
Dec 28, 2023

Conversation

carlosroman
Copy link
Contributor

@carlosroman carlosroman commented Dec 28, 2023

Noticed some tests failing due to not being able to pull dependencies down. Adding a cache in hope that it will stop that issue coming up again.
Caching doesn't work for the misbehaving JMX server as that is built in Docker and currently no way to share dependencies with the build process in Container Tests.

@carlosroman carlosroman force-pushed the carlosroman/circleci-deps-cache branch 3 times, most recently from 844cfcb to 0ee28f8 Compare December 28, 2023 12:42
@carlosroman carlosroman force-pushed the carlosroman/circleci-deps-cache branch from 0ee28f8 to 9a3c843 Compare December 28, 2023 12:50
@carlosroman carlosroman marked this pull request as ready for review December 28, 2023 12:50
@carlosroman carlosroman requested a review from a team as a code owner December 28, 2023 12:51
- restore_cache:
name: Restore Maven cache
keys:
# when pom.xml file changes, use increasingly general patterns to restore cache
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you explain this a little? The save-cache step uses the maven-cache anchor, which appears to be defined here.

So the value for maven-cache is (for example) maven-cache-master-ab2c3ffef33. What are the other 2 below this then?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other two are there incase this is a brand new branch. If the branch is new it will then try and find the latest cache that begins maven-cache-{{ .Branch }}- and if that fails then just grabs the latest version of the cache that maches maven-cache- (i.e. any branch). It then will save the cache after the first run as maven-cache-{{ .Branch }}-{{ checksum "pom.xml" }}-lint as that is what the maven-cache anchor value is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ooooh, thanks, that is helpful. So the anchor value for maven-cache is always the first (most specific) key. The cache-loading is circle-ci functionality that will pick the best key, but when it goes to save the key, it will save with the most specific key.

@carlosroman carlosroman merged commit 68232f3 into master Dec 28, 2023
9 checks passed
@carlosroman carlosroman deleted the carlosroman/circleci-deps-cache branch December 28, 2023 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants